from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from hyrobot.common import CHECK_POINT, STEP


class c73300d:
    name = "验证登录功能-73300d"
    driver = webdriver.Firefox()

    def teststeps(self):
        self.driver.implicitly_wait(3)
        self.driver.get("http://172.17.66.19:8080/")

        STEP(4, '输入已注册的账号和正确的密码，点击登录')
        self.driver.find_element(By.NAME, "username").send_keys('sunxidong')
        self.driver.find_element(By.NAME, "password").send_keys('123456')
        self.driver.find_element(By.CSS_SELECTOR, ".el-button").click()
        expetced_words1 = "产品列表"
        key_words1 = self.driver.find_element(By.CSS_SELECTOR,
        "#app > div > div.main-container > section > div.el-card.card.is-always-shadow > div > div:nth-child(1) > span").text
        CHECK_POINT("验证是否为期待文字", expetced_words1 == key_words1)

        self.driver.quit()